package test;

import java.util.Objects;

public class ITEmployee {

    private String name;
    private Integer age ;
    final private String technologyDirection;
    private Double workAge;

    public ITEmployee(String technologyDirection) {
        this.technologyDirection = technologyDirection;
    }

    public ITEmployee(String name, Integer age, String technologyDirection, Double workAge) {
        this.name = name;
        this.age = age;
        this.technologyDirection = technologyDirection;
        this.workAge = workAge;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        if (age < 15){
            System.out.println("年龄太小！！！！！");
            this.age = 15;
        }
        this.age = age;
    }

    public String getTechnologyDirection() {
        return technologyDirection;
    }

    public Double getWorkAge() {
        return workAge;
    }

    public void setWorkAge(Double workAge) {
        this.workAge = workAge;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        ITEmployee that = (ITEmployee) o;
        return Objects.equals(name, that.name) && Objects.equals(age, that.age) && Objects.equals(technologyDirection, that.technologyDirection) && Objects.equals(workAge, that.workAge);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, age, technologyDirection, workAge);
    }

    @Override
    public String toString() {
        return "ITEmployee{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", technologyDirection='" + technologyDirection + '\'' +
                ", workAge=" + workAge +
                '}';
    }

    public void work(String workUnit ,String workJob){

        System.out.println("姓名\t年龄\t技术方向\t工作年限\t工作单位\t职务");
        System.out.println(this.name+"\t"+this.age+"\t"+this.technologyDirection+"\t"+this.workAge+"\t"+workUnit+"\t\t"+workJob);

    }

}
